<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>HttpMessageConverter</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        $(function () {
            $("button").click(function () {
                $.post(
                    "/lishuoboy_springmvc_war_exploded/a8/5",
                    {
                        name: "张三",
                        hobby: "吃,喝",
                        hobby: "嫖,赌"
                    },
                    function (data, status) {
                        alert("数据: \n" + JSON.stringify(data) + "\n状态: " + status);
                    });
            });
        });
    </script>
</head>
<body>
<h1>八、HttpMessageConverter</h1>

<h1> 1、@RequestBody。【必须post请求,否则没有requestBody】</h1>
<form th:action="@{/a8/1}" method="post">
    <input name="id" value="111">
    <input name="name" value="张三">
    <input type="submit" value="提交">
</form>
<br/>

<h1>2、RequestEntity</h1>
<form th:action="@{/a8/2}" method="post">
    <input name="id" value="111">
    <input name="name" value="张三">
    <input type="submit" value="提交">
</form>
<br/>

<h1>5、SpringMVC处理ajax</h1>
<button>testAjax</button>

</body>
</html>